var e = require("../../../../@babel/runtime/helpers/typeof"), t = getApp();

Page({
    data: {
        language: "",
        mailLanguage: "",
        mailTeamReturnTitle: "",
        mailTeamLevel: "",
        mailTeamReturnName: "",
        mailReturnLog: "",
        team_level: "",
        level_power: 0,
        return_amount: "",
        activeName: "first",
        first_content: [],
        alreadyReturn: 0,
        each_return_rate: 0,
        order_return_rate: 0,
        returnAmountTotal: 0,
        notReturn: 0
    },
    onLoad: function(e) {
        this.checkrouter(), this.initMailLanguage(), this.getData(), this.getReturnListInfo();
    },
    checkrouter: function() {
        try {
            var t = function() {
                for (var e = wx.getStorageSync("yz_basic_info"), t = e.popularize_page.mini.vue_route, n = 0; n < t.length; n++) if ("teamlevel_return_center" == t[n]) return console.log(e.popularize_page.mini.mini_url + "跳转的路径"), 
                wx.showToast({
                    title: "未开启推广权限",
                    duration: 1e3,
                    icon: "none",
                    success: function() {
                        setTimeout(function() {
                            wx.redirectTo({
                                url: e.popularize_page.mini.mini_url
                            });
                        }, 1e3);
                    }
                }), {
                    v: void 0
                };
            }();
            if ("object" === e(t)) return t.v;
        } catch (e) {
            console.log(e);
        }
    },
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    initMailLanguage: function() {
        var e, n = this, a = t.getNetAddresss("setting.get-lang-setting");
        t._getNetWork({
            url: a,
            success: function(a) {
                var r = a.data;
                if (1 === r.result) {
                    e = r.data;
                    var i = t.setMailLanguage("团队赠送", e.team_return.team_return), o = t.setMailLanguage("经销商等级", e.team_return.team_level), u = t.setMailLanguage("赠送", e.team_return.return_name), l = t.setMailLanguage("赠送记录", e.team_return.return_log);
                    n.setData({
                        mailTeamReturnTitle: i,
                        mailTeamLevel: o,
                        mailTeamReturnName: u,
                        mailReturnLog: l
                    });
                } else wx.showToast({
                    title: r.msg,
                    icon: "none"
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    getData: function() {
        var e = this, n = t.getNetAddresss("plugin.team-return.api.team-return.get-team-return-statistic");
        t._getNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 === n.result ? e.setData({
                    team_level: n.data.team_level,
                    return_amount: n.data.return_amount,
                    level_power: n.data.level_power
                }) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    toReturnInfo: function(e) {
        var t = e.target.dataset.id || e.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageB/member/income/teamlevel_return_list_info/teamlevel_return_list_info?id=" + t
        });
    },
    getReturnListInfo: function() {
        var e = this, n = t.getNetAddresss("plugin.team-return.api.team-return.get-team-return-log");
        t._getNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 === n.result ? e.setData({
                    first_content: n.data
                }) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    }
});